package io.github.godfather1103.macro

import com.intellij.codeInsight.template.Expression
import com.intellij.codeInsight.template.ExpressionContext
import com.intellij.codeInsight.template.Macro
import com.intellij.codeInsight.template.Result

/**
 * <p>Title:        Godfather1103's Github</p>
 * <p>Copyright:    Copyright (c) 2023</p>
 * <p>Company:      https://github.com/godfather1103</p>
 *
 * @author  作者: Jack Chu E-mail: chuchuanbao@gmail.com
 * @date 创建时间：2023/8/24 15:38
 * @version 1.0
 * @since  1.0
 */
class ShowNonObjectMacro : Macro() {

    override fun getName(): String = "showNonObject"

    override fun getPresentableName(): String = "showNonObject(obj1, obj2, ...)"

    override fun calculateResult(params: Array<out Expression>, context: ExpressionContext?): Result? {
        return params.firstNotNullOfOrNull {
            it.calculateResult(context)
        }
    }
}